package PAPForLargeOntologiesToText;

import java.util.ArrayList;

import org.semanticweb.owlapi.model.OWLClass;

public class Block {
//	/** Coupling is a map of hashmap of other block and value of coupling. */
//	private Map<Block, Double> coupling = new HashMap<Block, Double>();
//	/** value of internal sum of links (cohesiveness). */
//	private Double cohesiveness;
//	/** The list of class in this block. */
	private ArrayList<PAPClass> listOfClasses = new ArrayList<PAPClass>();
	private ArrayList<Integer> blockToCompare;
	private int indexInCohesivenessCouplingMatrix;
	private boolean isConvergent = false;
	private Float cohesiveness;
	
	public Block() {
		super();
		blockToCompare = new ArrayList<Integer>();
	}
	
	public void addBlockToCompare(Integer index){
		blockToCompare.add(index);
	}
	
	public ArrayList<Integer> getBlockToCompare() {
		return blockToCompare;
	}

	public void setBlockToCompare(ArrayList<Integer> blockToCompare) {
		this.blockToCompare = blockToCompare;
	}

	public void addClass(PAPClass papClass){
		listOfClasses.add(papClass);
	}
	
	public void addAllClasses(ArrayList<PAPClass> owlClasses){
		listOfClasses.addAll(owlClasses);
	}
	
	public void removeClass(OWLClass owlClass){
		listOfClasses.remove(owlClass);
	}
	
//	public void putCoupling(Block key, Double value){
//		if (coupling.containsKey(key)) {
//			coupling.replace(key, value);
//		} else {
//			coupling.put(key, value);
//		}
//	}
//	
//	public void removeCoupling(Long key, Double value){
//		coupling.remove(key);
//	}
	
	/** calculate the number of classes in this block. */
	public int sizeOfBlock(){
		return Integer.valueOf(listOfClasses.size());
	}
	
//	/** return the block with best coupling for this block */
//	public Block maxCoupling(){
//		Block best = null;
//		for (Block blk : coupling.keySet()) {
//			if (best == null) {
//				best = blk;
//			} else {
//				if (coupling.get(blk) > coupling.get(best)) {
//					best = blk;
//				}
//			}
//		}
//		return best;
//	}
	
//	public Map<Block, Double> getCoupling() {
//		return coupling;
//	}
//	public void setCoupling(Map<Block, Double> coupling) {
//		this.coupling = coupling;
//	}
//	public Double getCohesiveness() {
//		return cohesiveness;
//	}
//	public void setCohesiveness(Double cohesiveness) {
//		this.cohesiveness = cohesiveness;
//	}
	public ArrayList<PAPClass> getListOfClasses() {
		return listOfClasses;
	}
	public void setListOfClasses(ArrayList<PAPClass> listOfClasses) {
		this.listOfClasses = listOfClasses;
	}

	public int getIndexInCohesivenessCouplingMatrix() {
		return indexInCohesivenessCouplingMatrix;
	}

	public void setIndexInCohesivenessCouplingMatrix(int indexInCohesivenessCouplingMatrix) {
		this.indexInCohesivenessCouplingMatrix = indexInCohesivenessCouplingMatrix;
	}

	public void setIndexInCohesivenessCouplingMatrix(int index1, int index2) {
		if (index1 < index2) {
			this.indexInCohesivenessCouplingMatrix = index1;
		} else {
			this.indexInCohesivenessCouplingMatrix = index2;
		}
		
	}

	public boolean isConvergent() {
		return isConvergent;
	}

	public void setConvergent(boolean isConvergent) {
		this.isConvergent = isConvergent;
	}

	public Float getCohesiveness() {
		return cohesiveness;
	}

	public void setCohesiveness(Float cohesiveness) {
		this.cohesiveness = cohesiveness;
	}

}
